package com.kelvem.saas.workbanch.ontology.order.handle.create;

import com.kelvem.saas.workbanch.fsm.entity.Entity;
import com.kelvem.saas.workbanch.fsm.core.EventContext;
import com.kelvem.saas.workbanch.fsm.handle.Handle;
import com.kelvem.saas.workbanch.ontology.order.model.OrdersEntity;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.UUID;

/**
 * @author kelvem
 */
@Service
@Slf4j
public class CreateOrderNoHandle extends Handle {
    
    @Override
    public void execute() {
        
        OrdersEntity order = Entity.instance().selectOne(OrdersEntity.class);
        order.setOrderNo(UUID.randomUUID().toString());
    
        log.info("Handle[" + getName() + "] order=" + order);
        EventContext.print();
    }
}
